<template>
  <div>被遗忘的定时器</div>
</template>

<script>
var count = 0
class Person {
  constructor(name) {
    this.name = name
  }
  sayHi() {
    console.log(`hello, i am ${this.name}`)
  }
}

function main() {
  let p1 = new Person('zhangsa')
  let p2 = new Person('wangwu')
  let p3 = new Person('james')

  p1.sayHi()
  p2.sayHi()
  setInterval(() => {
    if (count < 3) {
      p3.sayHi()
      count++
    }
  }, 100)
}

export default {
  mounted() {
    main()
  }
}
</script>
